3.159 \(\int (c+d x) (a+b \sin (e+f x))^2 \, dx\)

Optimal. Leaf size=116 \[ \frac {a^2 (c+d x)^2}{2 d}-\frac {2 a b (c+d x) \cos (e+f x)}{f}+\frac {2 a b d \sin (e+f x)}{f^2}-\frac {b^2 (c+d x) \sin (e+f x) \cos (e+f x)}{2 f}+\frac {1}{2} b^2 c x+\frac {b^2 d \sin ^2(e+f x)}{4 f^2}+\frac {1}{4} b^2 d x^2 \]

[Out]

1/2*b^2*c*x+1/4*b^2*d*x^2+1/2*a^2*(d*x+c)^2/d-2*a*b*(d*x+c)*cos(f*x+e)/f+2*a*b*d*sin(f*x+e)/f^2-1/2*b^2*(d*x+c
)*cos(f*x+e)*sin(f*x+e)/f+1/4*b^2*d*sin(f*x+e)^2/f^2

________________________________________________________________________________________

Rubi [A]  time = 0.10, antiderivative size = 116, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.222, Rules used = {3317, 3296, 2637, 3310} \[ \frac {a^2 (c+d x)^2}{2 d}-\frac {2 a b (c+d x) \cos (e+f x)}{f}+\frac {2 a b d \sin (e+f x)}{f^2}-\frac {b^2 (c+d x) \sin (e+f x) \cos (e+f x)}{2 f}+\frac {1}{2} b^2 c x+\frac {b^2 d \sin ^2(e+f x)}{4 f^2}+\frac {1}{4} b^2 d x^2 \]

Antiderivative was successfully verified.

[In]

Int[(c + d*x)*(a + b*Sin[e + f*x])^2,x]

[Out]

(b^2*c*x)/2 + (b^2*d*x^2)/4 + (a^2*(c + d*x)^2)/(2*d) - (2*a*b*(c + d*x)*Cos[e + f*x])/f + (2*a*b*d*Sin[e + f*
x])/f^2 - (b^2*(c + d*x)*Cos[e + f*x]*Sin[e + f*x])/(2*f) + (b^2*d*Sin[e + f*x]^2)/(4*f^2)

Rule 2637

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3296

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> -Simp[((c + d*x)^m*Cos[e + f*x])/f, x] +
Dist[(d*m)/f, Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rule 3310

Int[((c_.) + (d_.)*(x_))*((b_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(d*(b*Sin[e + f*x])^n)/(f^2*n
^2), x] + (Dist[(b^2*(n - 1))/n, Int[(c + d*x)*(b*Sin[e + f*x])^(n - 2), x], x] - Simp[(b*(c + d*x)*Cos[e + f*
x]*(b*Sin[e + f*x])^(n - 1))/(f*n), x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n, 1]

Rule 3317

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Sin[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[n, 0] && (EqQ[n, 1] ||
IGtQ[m, 0] || NeQ[a^2 - b^2, 0])

Rubi steps

\begin {align*} \int (c+d x) (a+b \sin (e+f x))^2 \, dx &=\int \left (a^2 (c+d x)+2 a b (c+d x) \sin (e+f x)+b^2 (c+d x) \sin ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}+(2 a b) \int (c+d x) \sin (e+f x) \, dx+b^2 \int (c+d x) \sin ^2(e+f x) \, dx\\ &=\frac {a^2 (c+d x)^2}{2 d}-\frac {2 a b (c+d x) \cos (e+f x)}{f}-\frac {b^2 (c+d x) \cos (e+f x) \sin (e+f x)}{2 f}+\frac {b^2 d \sin ^2(e+f x)}{4 f^2}+\frac {1}{2} b^2 \int (c+d x) \, dx+\frac {(2 a b d) \int \cos (e+f x) \, dx}{f}\\ &=\frac {1}{2} b^2 c x+\frac {1}{4} b^2 d x^2+\frac {a^2 (c+d x)^2}{2 d}-\frac {2 a b (c+d x) \cos (e+f x)}{f}+\frac {2 a b d \sin (e+f x)}{f^2}-\frac {b^2 (c+d x) \cos (e+f x) \sin (e+f x)}{2 f}+\frac {b^2 d \sin ^2(e+f x)}{4 f^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.73, size = 96, normalized size = 0.83 \[ -\frac {2 \left (2 a^2+b^2\right ) (e+f x) (d (e-f x)-2 c f)+16 a b f (c+d x) \cos (e+f x)-16 a b d \sin (e+f x)+2 b^2 f (c+d x) \sin (2 (e+f x))+b^2 d \cos (2 (e+f x))}{8 f^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)*(a + b*Sin[e + f*x])^2,x]

[Out]

-1/8*(2*(2*a^2 + b^2)*(e + f*x)*(-2*c*f + d*(e - f*x)) + 16*a*b*f*(c + d*x)*Cos[e + f*x] + b^2*d*Cos[2*(e + f*
x)] - 16*a*b*d*Sin[e + f*x] + 2*b^2*f*(c + d*x)*Sin[2*(e + f*x)])/f^2

________________________________________________________________________________________

fricas [A]  time = 0.61, size = 109, normalized size = 0.94 \[ \frac {{\left (2 \, a^{2} + b^{2}\right )} d f^{2} x^{2} + 2 \, {\left (2 \, a^{2} + b^{2}\right )} c f^{2} x - b^{2} d \cos \left (f x + e\right )^{2} - 8 \, {\left (a b d f x + a b c f\right )} \cos \left (f x + e\right ) + 2 \, {\left (4 \, a b d - {\left (b^{2} d f x + b^{2} c f\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{4 \, f^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*sin(f*x+e))^2,x, algorithm="fricas")

[Out]

1/4*((2*a^2 + b^2)*d*f^2*x^2 + 2*(2*a^2 + b^2)*c*f^2*x - b^2*d*cos(f*x + e)^2 - 8*(a*b*d*f*x + a*b*c*f)*cos(f*
x + e) + 2*(4*a*b*d - (b^2*d*f*x + b^2*c*f)*cos(f*x + e))*sin(f*x + e))/f^2

________________________________________________________________________________________

giac [A]  time = 0.97, size = 119, normalized size = 1.03 \[ \frac {1}{2} \, a^{2} d x^{2} + \frac {1}{4} \, b^{2} d x^{2} + a^{2} c x + \frac {1}{2} \, b^{2} c x - \frac {b^{2} d \cos \left (2 \, f x + 2 \, e\right )}{8 \, f^{2}} + \frac {2 \, a b d \sin \left (f x + e\right )}{f^{2}} - \frac {2 \, {\left (a b d f x + a b c f\right )} \cos \left (f x + e\right )}{f^{2}} - \frac {{\left (b^{2} d f x + b^{2} c f\right )} \sin \left (2 \, f x + 2 \, e\right )}{4 \, f^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*sin(f*x+e))^2,x, algorithm="giac")

[Out]

1/2*a^2*d*x^2 + 1/4*b^2*d*x^2 + a^2*c*x + 1/2*b^2*c*x - 1/8*b^2*d*cos(2*f*x + 2*e)/f^2 + 2*a*b*d*sin(f*x + e)/
f^2 - 2*(a*b*d*f*x + a*b*c*f)*cos(f*x + e)/f^2 - 1/4*(b^2*d*f*x + b^2*c*f)*sin(2*f*x + 2*e)/f^2

________________________________________________________________________________________

maple [B]  time = 0.04, size = 216, normalized size = 1.86 \[ \frac {\frac {a^{2} d \left (f x +e \right )^{2}}{2 f}+a^{2} c \left (f x +e \right )-\frac {a^{2} d e \left (f x +e \right )}{f}+\frac {2 a b d \left (\sin \left (f x +e \right )-\left (f x +e \right ) \cos \left (f x +e \right )\right )}{f}-2 a b c \cos \left (f x +e \right )+\frac {2 a b d e \cos \left (f x +e \right )}{f}+\frac {b^{2} d \left (\left (f x +e \right ) \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {\left (f x +e \right )^{2}}{4}+\frac {\left (\sin ^{2}\left (f x +e \right )\right )}{4}\right )}{f}+b^{2} c \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {b^{2} d e \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)*(a+b*sin(f*x+e))^2,x)

[Out]

1/f*(1/2*a^2/f*d*(f*x+e)^2+a^2*c*(f*x+e)-a^2/f*d*e*(f*x+e)+2/f*a*b*d*(sin(f*x+e)-(f*x+e)*cos(f*x+e))-2*a*b*c*c
os(f*x+e)+2/f*a*b*d*e*cos(f*x+e)+1/f*b^2*d*((f*x+e)*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)-1/4*(f*x+e)^2+1
/4*sin(f*x+e)^2)+b^2*c*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)-1/f*b^2*d*e*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*
f*x+1/2*e))

________________________________________________________________________________________

maxima [A]  time = 0.56, size = 202, normalized size = 1.74 \[ \frac {8 \, {\left (f x + e\right )} a^{2} c + 2 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2} c + \frac {4 \, {\left (f x + e\right )}^{2} a^{2} d}{f} - \frac {8 \, {\left (f x + e\right )} a^{2} d e}{f} - \frac {2 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2} d e}{f} - 16 \, a b c \cos \left (f x + e\right ) + \frac {16 \, a b d e \cos \left (f x + e\right )}{f} - \frac {16 \, {\left ({\left (f x + e\right )} \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right )} a b d}{f} + \frac {{\left (2 \, {\left (f x + e\right )}^{2} - 2 \, {\left (f x + e\right )} \sin \left (2 \, f x + 2 \, e\right ) - \cos \left (2 \, f x + 2 \, e\right )\right )} b^{2} d}{f}}{8 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*sin(f*x+e))^2,x, algorithm="maxima")

[Out]

1/8*(8*(f*x + e)*a^2*c + 2*(2*f*x + 2*e - sin(2*f*x + 2*e))*b^2*c + 4*(f*x + e)^2*a^2*d/f - 8*(f*x + e)*a^2*d*
e/f - 2*(2*f*x + 2*e - sin(2*f*x + 2*e))*b^2*d*e/f - 16*a*b*c*cos(f*x + e) + 16*a*b*d*e*cos(f*x + e)/f - 16*((
f*x + e)*cos(f*x + e) - sin(f*x + e))*a*b*d/f + (2*(f*x + e)^2 - 2*(f*x + e)*sin(2*f*x + 2*e) - cos(2*f*x + 2*
e))*b^2*d/f)/f

________________________________________________________________________________________

mupad [B]  time = 0.74, size = 143, normalized size = 1.23 \[ \frac {a^2\,d\,x^2}{2}+\frac {b^2\,d\,x^2}{4}+a^2\,c\,x+\frac {b^2\,c\,x}{2}-\frac {b^2\,c\,\sin \left (2\,e+2\,f\,x\right )}{4\,f}+\frac {b^2\,d\,{\sin \left (e+f\,x\right )}^2}{4\,f^2}+\frac {4\,a\,b\,c\,{\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2}{f}-\frac {b^2\,d\,x\,\sin \left (2\,e+2\,f\,x\right )}{4\,f}+\frac {2\,a\,b\,d\,\sin \left (e+f\,x\right )}{f^2}+\frac {2\,a\,b\,d\,x\,\left (2\,{\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2-1\right )}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*sin(e + f*x))^2*(c + d*x),x)

[Out]

(a^2*d*x^2)/2 + (b^2*d*x^2)/4 + a^2*c*x + (b^2*c*x)/2 - (b^2*c*sin(2*e + 2*f*x))/(4*f) + (b^2*d*sin(e + f*x)^2
)/(4*f^2) + (4*a*b*c*sin(e/2 + (f*x)/2)^2)/f - (b^2*d*x*sin(2*e + 2*f*x))/(4*f) + (2*a*b*d*sin(e + f*x))/f^2 +
 (2*a*b*d*x*(2*sin(e/2 + (f*x)/2)^2 - 1))/f

________________________________________________________________________________________

sympy [A]  time = 0.86, size = 219, normalized size = 1.89 \[ \begin {cases} a^{2} c x + \frac {a^{2} d x^{2}}{2} - \frac {2 a b c \cos {\left (e + f x \right )}}{f} - \frac {2 a b d x \cos {\left (e + f x \right )}}{f} + \frac {2 a b d \sin {\left (e + f x \right )}}{f^{2}} + \frac {b^{2} c x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {b^{2} c x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {b^{2} c \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} + \frac {b^{2} d x^{2} \sin ^{2}{\left (e + f x \right )}}{4} + \frac {b^{2} d x^{2} \cos ^{2}{\left (e + f x \right )}}{4} - \frac {b^{2} d x \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {b^{2} d \cos ^{2}{\left (e + f x \right )}}{4 f^{2}} & \text {for}\: f \neq 0 \\\left (a + b \sin {\relax (e )}\right )^{2} \left (c x + \frac {d x^{2}}{2}\right ) & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*sin(f*x+e))**2,x)

[Out]

Piecewise((a**2*c*x + a**2*d*x**2/2 - 2*a*b*c*cos(e + f*x)/f - 2*a*b*d*x*cos(e + f*x)/f + 2*a*b*d*sin(e + f*x)
/f**2 + b**2*c*x*sin(e + f*x)**2/2 + b**2*c*x*cos(e + f*x)**2/2 - b**2*c*sin(e + f*x)*cos(e + f*x)/(2*f) + b**
2*d*x**2*sin(e + f*x)**2/4 + b**2*d*x**2*cos(e + f*x)**2/4 - b**2*d*x*sin(e + f*x)*cos(e + f*x)/(2*f) - b**2*d
*cos(e + f*x)**2/(4*f**2), Ne(f, 0)), ((a + b*sin(e))**2*(c*x + d*x**2/2), True))

________________________________________________________________________________________